from datetime import datetime

from sqlalchemy import Column, String, DateTime, Integer, Float

from api.utils.base import Base


class KnowledgebaseItem(Base):
    __tablename__ = "t_knowledgebase_item"
    id: str = Column(String, primary_key=True)
    create_date: str = Column(DateTime, default=datetime.now, comment="创建时间")
    update_date: str = Column(DateTime,  default=datetime.now, comment="更新时间")
    thumbnail: str = Column(String, comment="缩略图Base64")
    kb_id: str = Column(String, comment="知识库ID")
    parser_id: str = Column(String, comment="解析ID")
    parser_config: str = Column(String, comment="解析配置")
    source_type: str = Column(String, comment="来源分类")
    type: str = Column(String, comment="文件类型")
    created_by: str = Column(String, comment="创建人")
    name: str = Column(String, comment="文档名称")
    location: str = Column(String, comment="文件路径")
    size: int = Column(Integer, comment="文件大小")
    token_num: int = Column(Integer, comment="token数量")
    chunk_num: int = Column(Integer, comment="分块数")
    progress: float = Column(Float, comment="进度")
    progress_msg: str = Column(String, comment="进度信息")
    process_begin_at: str = Column(DateTime, comment="开始解析时间")
    process_duration: float = Column(Float, comment="解析时长")
    run: str = Column(String, comment="解析状态", default="1")
    status: str = Column(String, comment="是否启用", default="1")